<template>
  <div class="app-container">

      <el-row>
  <el-col :span="24">
      <el-table
      :data="accountList"
      border
      style="width: 100%">
      <el-table-column
        label="编码"
        width="240">
        <template slot-scope="{row}">
          <span>{{ row.deliveryCode }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="合约" width="300">
        <template slot-scope="{row}">
          <div>{{ row.symbol }}</div>
        </template>
      </el-table-column>
      <el-table-column
        label="量">
        <template slot-scope="{row}">
          <div>{{ row.quantity }}</div>
        </template>
      </el-table-column>
      <el-table-column
        label="金额"
        width="100">
        <template slot-scope="{row}">
          <span>{{ row.amount }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="余额"
        width="100">
        <template slot-scope="{row}">
          <span>{{ row.balance }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="交易日期"
        width="120">
        <template slot-scope="{row}">
          <span>{{ row.tradeDate }}</span>
        </template>
      </el-table-column>
      <el-table-column
        prop="createdAt"
        label="创建时间"
        width="160">
      </el-table-column>
      </el-table>
  </el-col>
</el-row>
      
    
    <pagination v-show="total>0" :total="total" :page.sync="filterForm.page" :limit.sync="filterForm.size" @pagination="getDeliveryList" />

  </div>
</template>

<script>
//import { getFaultinessList,  removeFaultinessByID, changeFaultinessStatusByID } from '@/api/development/faultiness'
import waves from '@/directive/waves' // waves directive
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
import {getDeliveryList} from '@/api/strategy/delivery'
export default {
  name: 'accountAdmin',
  components: { Pagination },
  directives: { waves },
  filters: {
  },
  data() {
    return {
      
      socket:"",
      tableKey: 0,
      dataType:"1",
      windowHeight:"800",
      allowedLoaded:false,
      allowedLoadedRealtime:false,
      symbolOptions:[],
      signalFilterForm:{},
      accountList:[],
      total: 0,
      listLoading: false,
      connected:"loading",
      filterForm: {
        page: 1,
        size: 10,
        accountStatus:0,
        symbol:''
      }
    }
  },
  created() {
    //开启行情自动读取
    let historyAccountID = this.$route.query.accountID
    console.log(historyAccountID)
    if(historyAccountID){
      this.filterForm.accountID = historyAccountID
    }
    this.getDeliveryList()
  },
  mounted(){
  },
  destroyed(){
  },
  methods: {
    getDeliveryList:function(){
      let _this = this;
      console.log("期权",_this.filterForm)
      getDeliveryList(_this.filterForm).then((response) => {
        console.log("getDeliveryList",response)
          if (response.code === 200) {
            this.accountList = response.data.list
            this.total = response.data.total
          } else {
            _this.$message({
              message: response.msg,
              type: 'error'
            })
          }
      })
    },
    handleRefreshButton:function(){
        this.getList()
    },
    handleDetail:function(item){
    },
    handleFilter() {
      console.log("合约变动")
      this.filterForm.page = 1
      this.getDeliveryList()
    },
    sortChange(data) {
      const { prop, order } = data
      if (prop === 'id') {
        this.sortByID(order)
      }
    },
    sortByID(order) {
      if (order === 'ascending') {
        this.filterForm.sort = '+id'
      } else {
        this.filterForm.sort = '-id'
      }
      this.handleFilter()
    }
  }
}
</script>
<style>

</style>